package com.design_patterns.iterator.v1;

/**
 * @author: 李德才
 * @description:
 * @create: 2020-09-01 20:53
 **/
public class LinkedList_ {
    private Node head = null;
    private Node tail = null;
    private int size = 0;

    class Node {
        private Object element;
        private Object next;

        public Node(Object element) {
            this.element = element;
        }
    }

    public Integer size(){
        return  size;
    }

    public void add(Object object) {
        Node node = new Node(object);
        node.next = null;
        if (head == null) {
            head = node;
            tail = node;
        }
        tail.next = node;
        tail = node;
        ++size;
    }



}
